package com.gj.spartprice.enumpackge;

/**
 * Created by Tangyunhen on 2021-06-24.
 */
public enum CurrencyEnum2 {
    RMB(1,"人民币"),MY(0,"美元"),OY(2,"欧元"),FAKER(3,"法克");
    //枚举以Key Value的形式储存 KEY可以随便定义
    //必须定义value的类型
    private Integer currencyCode;
    private String currencyName;

    public String getcurrencyName() {
        return currencyName;
    }
    public Integer getcurrencyCode() {
        return currencyCode;
    }

    CurrencyEnum2(Integer currencyCode, String currencyName) {
        this.currencyCode = currencyCode;
        this.currencyName = currencyName;
    }

    public static String getcurrencyName(Integer currencyCode){
        for (CurrencyEnum2 c: CurrencyEnum2.values()) {
            if(c.getcurrencyCode()==currencyCode)
                return c.getcurrencyName();
        }
        return  null;
    }
}
